#include "Zip.h"

Zip::Zip()
{}

void haffman::zip() // 压缩字符串到缓冲区
{
  max_bu = bu = 0;
  char *s = r;
  for (int i = 0; i < lenth; ++i) // 压缩内容到buffer,直到 r 内容结束
  {
    int j = 0;
    for (j = 0; j < bas_len; ++j)
    {
      if (bas[j]->data == *s) break;
    }
    for (int k = bas[j]->code_len - 1; k >= 0; --k)
    {
      wbit(1 & (bas[j]->code >> k));
    }
    ++s;
  }
}
